package controllers;

import play.*;
import play.mvc.*;
import service.CommoditiesService;

import java.util.*;

import models.*;
import models.BaseEntity.Status;

public class Application extends Controller {

    public static void index() {
    	
    	List<Slide> slides = Slide.find("status != ? order by order", Status.DISABLED).fetch(4);
    	
    	//新品推荐
		List<Commodity> newArraivals = Commodity.find("order by lastModifiedAt, createAt desc").fetch(8);
		CommoditiesService.setCommodityPriceByUser(newArraivals, null);
		//热销排行
		List<Commodity> hots = Commodity.find("order by lastModifiedAt, createAt desc").fetch(6);
		CommoditiesService.setCommodityPriceByUser(hots, null);
        
        List<Brand> brands = Brand.find("order by lastModifiedAt, createAt desc").fetch(9);
        
        render(slides, newArraivals, hots, brands);
    }

    public static void search() {
    	
    	String searchKeyword = params.get("_search");
    	
    }
}